package org.toolbook.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;
/**
 * 添加足迹的验证器
 * @author meigang
 * @date 2015-07-13 22:39
 *
 */
public class AddFootValidator extends Validator{

	@Override
	protected void validate(Controller c) {
		validateString("startPoint", 1, 24, "startPoint_info", "起点长度[1-24]");
		validateString("endPoint", 1, 24, "endPoint_info", "终点长度[1-24]");
		validateString("weather", 1, 12, "weather_info", "天气长度[1-24]");
		validateString("heart", 1, 16, "heart_info", "心情长度[1-16]");
		validateRequired("mind", "mind_info", "感想不能为空");
		
	}

	@Override
	protected void handleError(Controller c) {
		// TODO Auto-generated method stub
		c.keepPara("startPoint");
		c.keepPara("endPoint");
		c.keepPara("weather");
		c.keepPara("heart");
		c.keepPara("mind");
		c.setAttr("nopass", 1);
		c.render("/WEB-INF/pages/fc/foot/add.jsp");
	}

}
